package com.lmiot.xyclick.Bean.SQL;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.internal.DaoConfig;

public class SearchBeanDao extends AbstractDao<SearchBean, Long> {
    public static final String TABLENAME = "SEARCH_BEAN";

    public static class Properties {
        public static final Property Id = new Property(0, Long.class, "id", true, "_id");
        public static final Property KeyWord = new Property(1, String.class, "keyWord", false, "KEY_WORD");
        public static final Property Time = new Property(2, String.class, "time", false, "TIME");
    }

    /* access modifiers changed from: protected */
    @Override // org.greenrobot.greendao.AbstractDao
    public final boolean isEntityUpdateable() {
        return true;
    }

    public SearchBeanDao(DaoConfig daoConfig) {
        super(daoConfig);
    }

    public SearchBeanDao(DaoConfig daoConfig, DaoSession daoSession) {
        super(daoConfig, daoSession);
    }

    public static void createTable(Database database, boolean z) {
        String str = z ? "IF NOT EXISTS " : "";
        database.execSQL("CREATE TABLE " + str + "\"SEARCH_BEAN\" (\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ,\"KEY_WORD\" TEXT UNIQUE ,\"TIME\" TEXT);");
    }

    public static void dropTable(Database database, boolean z) {
        StringBuilder sb = new StringBuilder();
        sb.append("DROP TABLE ");
        sb.append(z ? "IF EXISTS " : "");
        sb.append("\"SEARCH_BEAN\"");
        database.execSQL(sb.toString());
    }

    /* access modifiers changed from: protected */
    public final void bindValues(DatabaseStatement databaseStatement, SearchBean searchBean) {
        databaseStatement.clearBindings();
        Long id = searchBean.getId();
        if (id != null) {
            databaseStatement.bindLong(1, id.longValue());
        }
        String keyWord = searchBean.getKeyWord();
        if (keyWord != null) {
            databaseStatement.bindString(2, keyWord);
        }
        String time = searchBean.getTime();
        if (time != null) {
            databaseStatement.bindString(3, time);
        }
    }

    /* access modifiers changed from: protected */
    public final void bindValues(SQLiteStatement sQLiteStatement, SearchBean searchBean) {
        sQLiteStatement.clearBindings();
        Long id = searchBean.getId();
        if (id != null) {
            sQLiteStatement.bindLong(1, id.longValue());
        }
        String keyWord = searchBean.getKeyWord();
        if (keyWord != null) {
            sQLiteStatement.bindString(2, keyWord);
        }
        String time = searchBean.getTime();
        if (time != null) {
            sQLiteStatement.bindString(3, time);
        }
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public Long readKey(Cursor cursor, int i) {
        int i2 = i + 0;
        if (cursor.isNull(i2)) {
            return null;
        }
        return Long.valueOf(cursor.getLong(i2));
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public SearchBean readEntity(Cursor cursor, int i) {
        int i2 = i + 0;
        String str = null;
        Long valueOf = cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2));
        int i3 = i + 1;
        String string = cursor.isNull(i3) ? null : cursor.getString(i3);
        int i4 = i + 2;
        if (!cursor.isNull(i4)) {
            str = cursor.getString(i4);
        }
        return new SearchBean(valueOf, string, str);
    }

    public void readEntity(Cursor cursor, SearchBean searchBean, int i) {
        int i2 = i + 0;
        String str = null;
        searchBean.setId(cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2)));
        int i3 = i + 1;
        searchBean.setKeyWord(cursor.isNull(i3) ? null : cursor.getString(i3));
        int i4 = i + 2;
        if (!cursor.isNull(i4)) {
            str = cursor.getString(i4);
        }
        searchBean.setTime(str);
    }

    /* access modifiers changed from: protected */
    public final Long updateKeyAfterInsert(SearchBean searchBean, long j) {
        searchBean.setId(Long.valueOf(j));
        return Long.valueOf(j);
    }

    public Long getKey(SearchBean searchBean) {
        if (searchBean != null) {
            return searchBean.getId();
        }
        return null;
    }

    public boolean hasKey(SearchBean searchBean) {
        return searchBean.getId() != null;
    }
}
